import { createRouter, createWebHashHistory } from 'vue-router'
const Layout = () => import('@/views/layout/index.vue')
const Home = () => import('@/views/home/index.vue')
const FirstCategory = () => import('@/views/category/index.vue')
const SecondCategory = () => import('@/views/category/sub.vue')
const GoodsDetail = () => import('@/views/goods/index.vue')
const MyTest = () => import('@/views/test/index.vue')
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      { path: '/test', component: MyTest },
      { path: '/', component: Home },
      { path: '/category/:id', component: FirstCategory },
      { path: '/category/sub/:id', component: SecondCategory },
      { path: '/product/:id', component: GoodsDetail }

    ]
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior () {
    return { left: 0, top: 0 }
  }
})
export default router
